<?php

namespace app\controllers;

use Yii;
use yii\web\Controller;

class SelectController extends Controller
{
      //查询构件器
     
      $rows=(new \yii\db\Query())
      ->select('id','name')
      ->from('user')
      ->limit(10)
      ->all();
      $obj=Yii::$app->createCommand($rows)->queryAll();
}